package com.xx.chb01.design.factory.ff;

import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: chb
 * @Date: 2018/12/19 12:33
 * @Description:
 * 实现工厂角色，在工厂内需要实现产品的动态选择算法，使用HashMap维护状态code和具体产品的对象之间的映射关系，
 * 就可以非常容易的实现这一点，具体代码如下所示：
 */
public class FillCountServieFactory {

	private static Map fillCountServiceMap = new HashMap<>();

	static {
		fillCountServiceMap.put(1, new FirstStageService());
		fillCountServiceMap.put(2, new SecondStageService());
		fillCountServiceMap.put(3, new ThirdStageService());
		fillCountServiceMap.put(4, new ForthStageService());
		fillCountServiceMap.put(5, new FirthStageService());
		fillCountServiceMap.put(6, new SixthStageService());
	}

	public static FillCountService getFillCountStrategy(int statusCode) {
		return (FillCountService)fillCountServiceMap.get(statusCode);
	}
}
